@echo off

set arg1=%1
cd win_res

:vs2022e
set VCVARS64_PATH="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
if exist %VCVARS64_PATH% goto startBuild

:vs2022p
set VCVARS64_PATH="C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars64.bat"
if exist %VCVARS64_PATH% goto startBuild

:vs2019c
set VCVARS64_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
if exist %VCVARS64_PATH% goto startBuild

:vs2019d
set VCVARS64_PATH="D:\Program Files\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
if exist %VCVARS64_PATH% goto startBuild

:startBuild
if defined arg1 ( goto startRBuild )
@call %VCVARS64_PATH%
devenv framework.sln /Project INSTALL.vcxproj /build "Release|x64"
goto :end

:startRBuild
@call %VCVARS64_PATH%
devenv framework.sln /Project INSTALL.vcxproj /Rebuild "Release|x64"

:end
if not defined arg1 ( pause )
